using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection.Emit;
using System.Text;
using System.Threading.Tasks;
using bitzhuwei.Compiler;

namespace bitzhuwei.AnsiCFormat {
    /// <summary>
    /// Correspond to the Vn node struct_declaration in the grammar(AnsiC).
    /// </summary>
    internal partial class Vnstruct_declaration : IFullFormatter {
        // [110]=struct_declaration : specifier_qualifier_list struct_declarator_list ';' ;

        private readonly TokenRange _scope;
        private readonly Vnspecifier_qualifier_list r2;
        private readonly Vnstruct_declarator_list r1;
        private readonly Token r0;

        public TokenRange Scope => _scope;

        public void Format(TextWriter writer, FormatContext context) {
            throw new NotImplementedException();
        }

        public void FullFormat(BlankConfig preConfig, TextWriter writer, FormatContext context) {
            context.PrintBlanksAnd(r2, preConfig, writer);
            var config = new BlankConfig();
            context.PrintCommentsBetween(r2, r1, config, writer);
            context.PrintBlanksAnd(r1, config, writer);
            context.PrintCommentsBetween(r1, r0, config, writer);
            context.PrintBlanksAnd(r0, config, writer);
        }

        public IEnumerable<string> YieldTokens(TextWriter writer, FormatContext context) {
            throw new NotImplementedException();
        }

        // [110]=struct_declaration : specifier_qualifier_list struct_declarator_list ';' ;
        // dumped by DefaultExtractor
        internal Vnstruct_declaration(Vnspecifier_qualifier_list r2, Vnstruct_declarator_list r1, Token r0) {
            this.r2 = r2;
            this.r1 = r1;
            this.r0 = r0;
            this._scope = new TokenRange(r2, r0);
        }

    }
}
